package com.as.utils;

/**
 * Created by 汪贵春 on 2017/2/28.
 */
public class RandomUtils {

    public static String getRandomString(int length) {
        String string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRTUVWXYZ";
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            int index = (int) (Math.random() * string.length());
            sb.append(string.charAt(index));
        }
        return sb.toString();
    }

    public static int getRandomInteger(int length) {
        return (int) (Math.random() * Math.pow(10, length));
    }

}
